"""Repetition of patterns
注意：使用正则表达式区间表示，一定要从小到大
"""

from re_test_patterns import test_patterns

test_patterns(
    'This is some text -- with punctuation.',
    [
        ('[a-z]+', '匹配英文小写字母'),
        ('[A-Z]+', '匹配英文大写字母'),
        ('[a-zA-Z]+', '匹配英文大小写字母'),
        ('[A-Za-z]+', '匹配英文大小写字母'),
        ('[A-Z][a-z]+', '一个英文大写字母后面跟着一个或者多个小写字母')
    ]
)

test_patterns(
    'This is some text with number 12345324 1324 234',
    [
        ('[a-z]+', '匹配英文小写字母'),
        ('[A-Z]+', '匹配英文大写字母'),
        ('[a-zA-Z]+', '匹配英文大小写字母'),
        ('[A-Za-z]+', '匹配英文大小写字母'),
        ('[A-Z][a-z]+', '一个英文大写字母后面跟着一个或者多个小写字母'),
        ('[0-9]+', '匹配数字'),
        ('[0123456789]+', '匹配数字'),
        ('[0-37-9]+', '匹配数字0到3、7-9'),
    ]
)

test_patterns(
    '这是可爱的中国',
    [
        ('[中国]+', "匹配字符中国")
    ]
)
